<?php
class news_post_add extends SClass {

    public function process() {
        try {
            if ($this->getControlValue('ok')) {
        	   ServiceUtils::GetFactory()->getNewsService()->addNews(
        	       $this->getControlValue('title'),
        	       $this->getControlValue('preview'),
        	       $this->getControlValue('content')
        	   );
        	   $this->assign('message', 'ok');
            }
        } catch (ServiceUtils_Exception $e) {
            $this->assign('errors', $e->getErrors());
        }
    }

}